<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>收费详情</title>
    <link rel="stylesheet" href="/js/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/common.css" media="all">
    <script src="/js/layui/layui.all.js"></script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">

        <div class="layui-card-body">
            <table class="layui-hide" id="t" lay-filter="t"></table>
        </div>
    </div>
</div>
</body>

<script src="/js/layui/layui.js"></script>
<script src="/js/layui/layui.all.js"></script>
<script src="/admin/js/token.js"></script>
<script>
    var $ = layui.$;
    var table = layui.table;
    var form = layui.form;

    //验证是不是数字
    form.verify({
        double: function(value){
            if(/^\d+$/.test(value)==false && /^\d+\.\d+$/.test(value)==false)
            {
                return '你输入的不是数字';
            }
        },
        datetime: function (value) {
            if(value != ""){
                if( /^(?:19|20)[0-9][0-9]-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:[0-2][1-9])|(?:[1-3][0-1])) (?:(?:[0-2][0-3])|(?:[0-1][0-9])):[0-5][0-9]:[0-5][0-9]$/.test(value)==false)
                {
                    return '日期格式不正确';
                }
            }
        }
    });

    function getQueryVariable(variable)
    {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
            var pair = vars[i].split("=");
            if(pair[0] == variable){return pair[1];}
        }
        return(false);
    }

    var url = '/shoufei/getRechargeRecord?sfr='+getQueryVariable("id") ;

    if(getQueryVariable("timeStart")) {
        url += "&start_time="+getQueryVariable("timeStart")
    }

    if(getQueryVariable("timeEnd")) {
        url += "&end_time="+getQueryVariable("timeEnd")
    }

    table.render({
        elem: '#t',
        id: 'tt',
        toolbar: '#tb',
        // toolbar: '#toolbarDemo', //开启头部工具栏，并为其绑定左侧模板
        url: url ,
        cols: [
            [{
                field: 'id',
                title: '序号',
                type: 'numbers',
                align: 'center'
            },
                {
                    field: 'uname',
                    title: 'App账号',
                    width : '13%',
                    align: 'center'
                },
                {
                    field: 'umail',
                    title: '邮箱',
                    width: '18%',
                    align: 'center'
                },
                {
                    field: 'money',
                    title: '充值金额',
                    width : '15%',
                    align: 'center'
                },
                {
                    field: 'recharge_time',
                    title: '充值时长(分钟)',
                    width : '15%',
                    align: 'center'
                },
                {
                    field: 'shenyu_time',
                    title: '剩余时长(分钟)',
                    width : '12%',
                    align: 'center'
                },
                {
                    field: 'create_time',
                    title: '充值时间',
                    width: '20%',
                    align: 'center'
                 }]
                // {
                //     field: 'sfrName',
                //     title: '操作人员',
                //     width: '15%',
                //     align: 'center'
                // }]
        ],
        limit:10,
        page: true,
        page: {
            //curr: layui.data("shijianjilu_page").index
        },
        done: (res, curr, count) => {
            //console.log(res);
            layui.data("shijianjilu_page", {
                key: 'index',
                value: curr
            });
        }
    });

    $('.test-table-operate-btn .layui-btn').on('click', function () {
        var type = $(this).data('type')
        active[type] ? active[type].call(this) : ''
    });

</script>
</html>
